package com.rc.evcharger.rabbit.queue;

import com.rc.evcharger.common.config.RabbitListenerConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.CustomExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SecondSaasQueueConfig {

    /**
     * 新增队列
     **/
    @Bean
    public Queue wxPayRefundPointsQueue() {
        return new Queue(RabbitListenerConstant.WX_PAYMENT_REFUND_POINTS_ORDER_QUEUE);
    }
    @Bean
    public Queue miniPayRefundPointsQueue() {
        return new Queue(RabbitListenerConstant.MINI_PAYMENT_REFUND_POINTS_ORDER_QUEUE);
    }


    /**
     * 建立绑定关系
     **/
    @Bean
    public Binding wxPayRefundPointsBinding(@Qualifier("secondSaasExchange") CustomExchange customExchange) {
        return BindingBuilder.bind(wxPayRefundPointsQueue()).to(customExchange).with(RabbitListenerConstant.WX_PAYMENT_REFUND_POINTS_ORDER_QUEUE).noargs();
    }
    @Bean
    public Binding miniPayRefundPointsBinding(@Qualifier("secondSaasExchange") CustomExchange customExchange) {
        return BindingBuilder.bind(miniPayRefundPointsQueue()).to(customExchange).with(RabbitListenerConstant.MINI_PAYMENT_REFUND_POINTS_ORDER_QUEUE).noargs();
    }
}
